<template>
    <view class="container">
        <view class="tui-bg"></view>
        <view class="tui-content">
            <view class="tui-form">
                <image src="/static/images/mall/img_recharge_success.png" class="tui-icon"></image>
                <view class="tui-title">订单支付成功</view>
                <view class="tui-sub-title">感谢您选择柳江科技，我们将为您提供优质服务</view>
                <view class="tui-price-info" v-if="payPrice > 0">
                    <text class="tui-price-label">支付金额：</text>
                    <text class="tui-price-amount">￥{{ fen2yuan(payPrice) }}</text>
                </view>
                <view class="tui-btn-box">
                    <tui-button type="danger" width="240rpx" height="70rpx" :size="28" plain shape="circle"
                        @click="go(1)">继续购物</tui-button>
                    <tui-button type="danger" shadow width="240rpx" height="70rpx" :size="28" shape="circle"
                        @click="go(2)">我的订单</tui-button>
                </view>
            </view>
        </view>
        <view class="tui-tips">
            <view class="tui-grey">温馨提示:</view>
            <view class="tui-light-grey">
                付款成功后，柳江科技不会以付款异常、卡单、系统升级为由联系您。请勿泄露银行卡号、手机验证码，否则会造成钱款损失！谨防电话诈骗！
            </view>
            <view class="tui-company-info">
                <view class="tui-company-name">柳江科技便民服务站</view>
                <view class="tui-company-desc">专业、安全、便捷的科技服务</view>
            </view>
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                orderId: '',
                payPrice: 0
            }
        },
        onLoad(options) {
            // 获取传递的订单信息
            if (options.orderId) {
                this.orderId = options.orderId;
            }
            if (options.payPrice) {
                this.payPrice = options.payPrice;
            }
            // 通知购物车页面刷新（订单支付成功后，后端会自动删除购物车商品）
            uni.$emit('refreshCart');
        },
        methods: {
            // 分转元函数
            fen2yuan(price) {
                return (Number(price) / 100).toFixed(2);
            },
            go(page) {
                if (page == 1) {
                    uni.switchTab({
                        url: "/pages/index/index"
                    })
                } else {
                    this.f.nav("../myOrder/myOrder")
                }
            }
        }
    }
</script>

<style>
    .tui-bg {
        width: 100%;
        height: 260rpx;
        background: linear-gradient(20deg, #E41F19, #F34B0B);
        border-bottom-left-radius: 42rpx;
    }

    .tui-content {
        padding: 0 35rpx;
        box-sizing: border-box;
    }

    .tui-form {
        background: #fff;
        height: 500rpx;
        box-shadow: 0 10rpx 14rpx 0 rgba(0, 0, 0, 0.08);
        border-radius: 10rpx;
        margin-top: -160rpx;
        position: relative;
        z-index: 10;
        display: flex;
        align-items: center;
        flex-direction: column;
    }

    .tui-icon {
        width: 100rpx;
        height: 100rpx;
        display: block;
        margin-top: 60rpx;
    }

    .tui-title {
        font-size: 48rpx;
        line-height: 48rpx;
        padding-top: 28rpx;
        font-weight: bold;
        color: #e93323;
        text-shadow: 0 2rpx 4rpx rgba(233, 51, 35, 0.1);
    }

    .tui-sub-title {
        color: #666666;
        font-size: 30rpx;
        line-height: 36rpx;
        padding-top: 20rpx;
        text-align: center;
        max-width: 500rpx;
        margin: 0 auto;
    }

    .tui-price-info {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-top: 20rpx;
        padding: 24rpx 40rpx;
        background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
        border-radius: 24rpx;
        border: 3rpx solid #e93323;
        box-shadow: 0 4rpx 12rpx rgba(233, 51, 35, 0.15);
    }

    .tui-price-label {
        font-size: 28rpx;
        color: #666;
        margin-right: 12rpx;
        font-weight: 500;
    }

    .tui-price-amount {
        font-size: 36rpx;
        font-weight: bold;
        color: #e93323;
        text-shadow: 0 2rpx 4rpx rgba(233, 51, 35, 0.2);
    }

    .tui-btn-box {
        width: 580rpx;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-top: 88rpx;
    }

    .tui-tips {
        font-size: 26rpx;
        padding: 48rpx 90rpx;
        box-sizing: border-box;
        text-align: justify;
        line-height: 48rpx;
    }

    .tui-grey {
        color: #555;
        padding-bottom: 8rpx;
    }

    .tui-light-grey {
        color: #888;
        line-height: 40rpx;
    }

    .tui-company-info {
        margin-top: 30rpx;
        padding: 20rpx;
        background: linear-gradient(135deg, #e93323 0%, #ff6b6b 100%);
        border-radius: 16rpx;
        text-align: center;
    }

    .tui-company-name {
        color: #fff;
        font-size: 32rpx;
        font-weight: bold;
        margin-bottom: 8rpx;
    }

    .tui-company-desc {
        color: rgba(255, 255, 255, 0.9);
        font-size: 24rpx;
        line-height: 1.4;
    }
</style>